/* < 商品管理  */


//    GoodsManager

import http from "./http"


//获取商品管理列表
// goods/list?
//pageNumber=1&pageSize=10
const goods = (pageNumber = 1, pageSize = 10) => {
    return http.get('/api/goods/list', {
        params: {
            pageNumber, pageSize
        }
    })
};
//下架
const goodsRemove = (ids) => {
    return http.put('/api/goods/status/0', {
        ids: [ids]
    });

};
//上架
const goodsInfo = (ids) => {
    return http.put('/api/goods/status/1', {
        ids: [ids]
    });

};
/* //修改商品管理信息
const carouselsUpdate = (data) => {
    return http.put('/api/carousels', data);
};
//新增商品管理信息
const carouselsInsert = (data) => {
    return http.post('/api/carousels', data)
} */

/* 商品管理==》表单 */
//获取分类列表
const categories = (pageNumber = 1, pageSize = 10, categoryLevel = 1, parentId = 0) => {
    return http.get('/api/categories', {
        params: {
            pageNumber, pageSize, categoryLevel, parentId
        }
    })
}
//新增商品信息
const goodsInsert = (data) => {
    return http.post('/api/goods', data)
}
//获取单个商品列表
const goodsInfoID = (id) => {
    return http.get(`/api/goods/${id}`)
}

export default {
    goods, goodsRemove, goodsInfo, categories, goodsInsert, goodsInfoID
}